#include "displaytime.h"
#include<QDebug>
DisplayTime::DisplayTime(QWidget *parent) :
    QLabel(parent)
{
    //setAttribute(Qt::WA_TranslucentBackground);
    //setAttribute(Qt::WA_TransparentForMouseEvents);
    setStyleSheet("QLabel{"
                  "color:rgba(0,0,0,255);"
                  "font-size:24px;"
                  "font-weight:bold"
                  "}");
    resize(QSize(260,50));
    updateTime();
    timerId=startTimer(1000);

}

void DisplayTime::timerEvent(QTimerEvent *event){
    if(event->timerId()==timerId)
    {
        updateTime();
    }
}

void DisplayTime::updateTime(){
    setText(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
}
